// https://www.luogu.com.cn/problem/P1223

#include <iostream>
#include <queue>
#include <unordered_map>
using namespace std;

int main() {
    int n, t;
    scanf("%d", &n);
    unordered_map<int, vector<int>> mp;

    priority_queue<int, vector<int>, greater<int>> Q;
    for (int i = 0; i < n; i++) {
        scanf("%d", &t);
        if (mp.find(t) == mp.end()) {
            mp[t] = vector<int>(1, i + 1);
        } else {
            mp[t].push_back(i + 1);
        }
        Q.push(t);
    }
    double ans = 0.0;
    long long wait = 0;
    while (!Q.empty()) {
        const int w = Q.top();
        for (int i=0; i < mp[w].size(); i++) {
            printf("%d ", mp[w][i]);
            Q.pop();
            ans += wait;
            wait += w;
        }
    }
    printf("\n%.2lf\n", ans / n);
    return 0;
}